package com.zeltov.controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import com.zeltov.api.CarService;
import com.zeltov.api.CarTO;
import com.zeltov.bo.Car;
import com.zeltov.dao.CarDAO;

public class HelloController implements Controller {

    protected static Logger log =LoggerFactory.getLogger(HelloController.class);

    @Autowired
    @Qualifier("carFacade")
    CarService carFacade;
    public void testPerson() {
        // insert test logic here
    	List<CarTO> allCars2 = carFacade.getAllCars();
    	for (CarTO carTO : allCars2) {
			System.out.println(carTO);
		}
    }

    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
    	log.debug("********************");
    	log.info("Returning hello view");
        testPerson();
        return new ModelAndView("hello");
    }

}